﻿using JetBrains.ProjectModel;
using JetBrains.ReSharper.Daemon;
using JetBrains.ReSharper.Daemon.CSharp.Stages;

namespace Sapphire.RSharp
{
  [DaemonStage(StagesBefore = new[] { typeof(TypeMemberErrorStage) },
    StagesAfter = new[] { typeof(LanguageSpecificDaemonStage) })]
  public class CustomDeclarationStage : CSharpDaemonStageBase
  {
    // Methods
    public override IDaemonStageProcess CreateProcess(IDaemonProcess process, DaemonProcessKind processKind)
    {
      if (!IsSupported(process.ProjectFile))
      {
        return null;
      }
      return new SapphireStageProcess(process);
    }

    public override ErrorStripeRequest NeedsErrorStripe(IProjectFile projectFile)
    {
      if (!IsSupported(projectFile))
      {
        return ErrorStripeRequest.NONE;
      }
      return ErrorStripeRequest.STRIPE;
    }
  }
}